class UserNotifier < ActionMailer::Base
  def signup_notification(user)
    p ' trying to send email'
    setup_email(user)
    @subject    += 'Please activate your new account'
  
    @body[:url]  = "https://damnit.jupiterit.com/users/activate/#{user.activation_code}"
  
  end
  def admin_signup_notification(user)
    @recipients  = "justin@jupiterit.com"
    @from        = "accounts@jupiterit.com"
    @subject     = user.email+ " signed up for damnit"
    @sent_on     = Time.now
    @body[:user] = user
  end
  def activation(user)
    setup_email(user)
    @subject    += 'Your account has been activated!'
    @body[:url]  = "https://damnit.jupiterit.com/"
  end
  
  def error_notification(error)
    @recipients = error.user.email
    @from        = "accounts@jupiterit.com"
    @subject     = "Damn IT! "+error.subject
    @sent_on     = Time.now
    @body[:error] = error
  end
  
  
  protected
    def setup_email(user)
      @recipients  = "#{user.email}"
      @from        = "accounts@jupiterit.com"
      @subject     = "Damn IT: "
      @sent_on     = Time.now
      @body[:user] = user
    end
end
